home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 3.iso / dist / fw_squid.idb / usr / freeware / squid / doc / Release-Notes-1.0.txt.z / Release-Notes-1.0.txt
Text File  |  2000-04-13  |  17KB  |  405 lines

  1.  
  2. $Id: Release-Notes-1.0.txt,v 1.5 1997/07/16 20:31:49 wessels Exp $
  3.  
  4. Release Notes for version 1.0 of the Squid cache.
  5.  
  6. TABLE OF CONTENTS:
  7.  
  8.     Private Objects
  9.     Proper parsing of HTTP reply codes
  10.     Support for If-Modified-Since GET
  11.     Improvements to the access log
  12.     Metadata reloads in the background
  13.     Unlinking swap files on restart and the -U option
  14.     Changes to debugging
  15.     New Access Control scheme
  16.     Using SIGHUP to reconfigure the cache
  17.     ftpget server
  18.     Changes to cache shutdown
  19.     Assigning weights to cache neighbors
  20.     Converting 'cache/log' from cached-1.4.pl3
  21.     Notes on stoplists vs ttl_pattern
  22.         SIGUSR1 now rotates log files
  23.     ``no-query'' option for cache_host lines
  24.  
  25.  
  26. Private Objects
  27. ==============================================================================
  28.  
  29. The Squid cache uses the notions of ``private'' and ``public''
  30. objects.  An object can start out as being private, but may later be
  31. given public status.  Private objects are associated with only a single
  32. client whereas a public object may be sent to multiple clients at the
  33. same time.  When the cache finishes retrieving an object, if the object
  34. is private it will be ejected from the cache.  Only public objects
  35. are saved on disk.
  36.  
  37. There are a few ways to determine whether an object should be private
  38. or public.  One is the request method.  Only URLs requested with
  39. the ``GET'' method can be public.  Another way is by examining the 
  40. URL string.  URLs which match one of the stoplist entries will 
  41. always be private objects.  Usually this includes ``cgi-bin'' scripts.
  42. A third way is by checking the HTTP request and reply headers.  For 
  43. example, if the request includes user authentication information, then
  44. the object should never be made public.  Additionally, some HTTP
  45. replies such as ``401 Unauthorized'' should also never be made public.
  46.  
  47. For these reasons, Squid starts all objects out as private and changes
  48. them to public only after the HTTP reply headers have been read.
  49.  
  50. Unfortunately, this causes some problems with the UDP-based Internet
  51. Cache Protocol (ICP) used to query neighboring caches.  Specifically, when
  52. an ICP reply packet is received, it only contains the object URL which
  53. is not sufficient enough to locate private objects in the cache metadata.
  54. To get the additional information needed to locate private objects, we
  55. decided to use the ``reqnum'' field of the ICP packet.  This is an
  56. acceptable solution, except that as implemented in cached-1.4.pl3 and
  57. earlier, all ICP replies have the reqnum field reset to zero!
  58.  
  59. Squid will make use of private objects until it notices that one of
  60. its neighbors is sending ICP replies with the reqnum field set to zero.
  61. It will then only use private keys for objects which are not going to
  62. be queried for via ICP.  These include objects in the stoplist and
  63. If-Modified-Since requests.  
  64.  
  65. Proper parsing of HTTP reply codes
  66. ==============================================================================
  67.  
  68. Squid parses HTTP replies to extract the reply code.  The codes are used
  69. to determine which objects should be cached, which should be ejected,
  70. and which should be negative-cached. 
  71.  
  72. See HTTP-codes.txt for a list of HTTP response codes, and how they are
  73. cached.
  74.  
  75. The HTTP codes are now logged to "access.log" in the native format 
  76. (ie with 'emulate_httpd_log off').
  77.  
  78. Support for If-Modified-Since GET
  79. ==============================================================================
  80. Squid supports IMS GET retrievals, but not through any neighbor caches.
  81. Whenever an IMS GET request is received, Squid handles the requst in
  82. one of three ways:
  83.  
  84.     * if the object is not in the cache, the request is treated as
  85.       a regular MISS.
  86.     * if the object is in the cache, and it has a more recent timestamp,
  87.       it is treated as a regular HIT.
  88.     * otherwise the cached object is assumed to be valid, and Squid
  89.       returns a NOT MODIFIED response.
  90.  
  91. This means you should chose your TTL settings very carefully. 
  92.  
  93. Improvements to the access log
  94. ==============================================================================
  95. The "access.log" file has been improved in a number of ways.  There is now
  96. only one log entry per client request and the size is always correct. 
  97. The format is now
  98.  
  99.    timestamp  elapsed  src-address  type/code/hierarchy  size  method  URL
  100.  
  101.     - timestamp:    When the request is completed with millisecond
  102.             resolution.
  103.     - elapsed:    elapsed time of the request, in milliseconds.
  104.     - src-address:     IP address of the requesting client.
  105.     - type:        An indication of how the request was handled
  106.             by the cache.  These are described further below.
  107.     - code:     The HTTP reply code when available.  For ICP
  108.             requests this is always "000."  If the reply code
  109.             was not given, it will be logged as "555."
  110.     - hierarchy:    The code from the hierarchy.log file.
  111.     - size:        For TCP requests, the amount of data written
  112.             to the client.  For UDP requests, the size
  113.             of the request (in bytes).
  114.     - method:    The request method (GET, POST, etc).
  115.     - URL:        The URL of the request.
  116.  
  117. Access Log Types:
  118.  
  119. "TCP_" refers to requests on the HTTP port (3128)
  120.  
  121.     TCP_HIT        A valid copy of the requested object was in the cache.
  122.     TCP_MISS    The requested object was not in the cache.
  123.     TCP_EXPIRED    The object was in the cache, but it had expired.
  124.     TCP_REFRESH    The user forced a refresh ("reload").
  125.     TCP_IFMODSINCE    An If-Modified-Since GET request.
  126.     TCP_SWAPFAIL    The object was believed to be in the cache,
  127.             but could not be accessed.
  128.     TCP_DENIED    Access was denied for this request.
  129.  
  130. "UDP_" refers to requests on the ICP port (3130)
  131.  
  132.     UDP_HIT        A valid copy of the requested object was in the cache.
  133.     UDP_HIT_OBJ    Same as UDP_HIT, but the object data was small enough
  134.             to be sent in the UDP reply packet.  Saves the
  135.             following TCP request.
  136.     UDP_MISS    The requested object was not in the cache.
  137.     UDP_DENIED    Access was denied for this request.
  138.     UDP_INVALID    An invalid request was received.
  139. ..............................................................................
  140. Hierarchy Log Types:
  141.  
  142.     DEAD_NEIGHBOR        A sibling has been detected as dead after
  143.                 failing to reply to 20 consecutive ICP
  144.                 queries.
  145.     DEAD_PARENT        A parent has been detected as dead.
  146.     DIRECT            The object has been requested from the origin
  147.                 server.
  148.     FIREWALL_IP_DIRECT    The object has been requested from the origin
  149.                 server because the origin host IP address is
  150.                 inside your firewall.
  151.     FIRST_PARENT_MISS    The object has been requested from the
  152.                 parent cache with the fastest weighted round
  153.                 trip time.
  154.     FIRST_UP_PARENT        The object has been requested from the first
  155.                 available parent in your list.
  156.     LOCAL_IP_DIRECT        The object has been requested from the origin
  157.                 server because the origin host IP address 
  158.                 matched your 'local_ip' list.
  159.     NEIGHBOR_HIT        The object was requested from a sibling cache
  160.                 which replied with a UDP_HIT.
  161.     NO_DIRECT_FAIL        The object could not be requested because
  162.                 of firewall restrictions and no parent caches
  163.                 were available.
  164.     NO_PARENT_DIRECT    The object was requested from the origin server
  165.                 because no parent caches exist for the URL.
  166.     PARENT_HIT        The object was requested from a parent cache
  167.                 which replied with a UDP_HIT.
  168.     REVIVE_NEIGHBOR        A sibling cache was detected as alive again.
  169.     REVIVE_PARENT        A parent cache was detected as alive again.
  170.     SINGLE_PARENT        The object was requested from the only
  171.                 parent cache appropriate for this URL.
  172.     SOURCE_FASTEST        The object was requested from the origin server
  173.                 because the 'source_ping' reply arrived first.
  174.     UDP_HIT_OBJ        The object was received in a UDP_HIT_OBJ reply
  175.                 from a neighbor cache.
  176.  
  177. Almost any of these may be preceeded by 'TIMEOUT_' if the two-second
  178. (default) timeout occurs waiting for all ICP replies to arrive from
  179. neighbors.
  180.  
  181.  
  182. Metadata reloads in the background
  183. ==============================================================================
  184. Upon restart, Squid automatically loads cache metadata in the
  185. background.  It will be able to service new requests immediately.  As
  186. new objects are added, there may be some "clashes" with old objects
  187. using the same swap file on disk.  In these cases you may see a message
  188. in the cache logfile about "Active clash."  This means the old object
  189. has been discarded since it was replaced by a new object.
  190.  
  191. The -F option causes the old behaviour -- reload all the metadata before
  192. processing any requests,
  193.  
  194.  
  195. Unlinking swap files on restart and the -U option
  196. ==============================================================================
  197. When the cache reloads object metadata from disk some of the objects
  198. will be expired or otherwise invalid.  In the interest of speed, these
  199. invalid objects will not be removed from the filesystem by default.  They
  200. will eventually be overwritten by new objects as enter the cache and
  201. get saved to disk.
  202.  
  203. The -U option can be used to actually remove the invalid objects from
  204. disk.  
  205.  
  206. In addition, the -z option will not cause 'rm -rf [0-9][0-9]' to be
  207. executed unless the -U option is also given.  
  208.  
  209. When swap files are not removed during restart there internal counters
  210. for disk space taken will not match the actual disk space used.  If you
  211. have a large cache or plenty of extra disk space, this should not be a
  212. problem.  However, if space is an issue, you may want to use the -U
  213. option at the cost of a slower restart.
  214.  
  215.  
  216. Changes to debugging
  217. ==============================================================================
  218. Squid has a flexible debugging scheme.  You can enable more debugging
  219. for certain functions and less for others.  For example if you needed
  220. to figure out why your access controls were behaving strangely, you 
  221. could enable debugging for section 28 at level 9.  Currently, each
  222. section corresponds to separate source code file:
  223.  
  224.     main.c:              Section 1
  225.     cache_cf.c:          Section 3
  226.     errorpage.c:         Section 4
  227.     comm.c:              Section 5
  228.     disk.c:              Section 6
  229.     fdstat.c:            Section 7
  230.     filemap.c:           Section 8
  231.     ftp.c:               Section 9
  232.     gopher.c:            Section 10
  233.     http.c:              Section 11
  234.     icp.c:               Section 12
  235.     icp_lib.c:           Section 13
  236.     ipcache.c:           Section 14
  237.     neighbors.c:         Section 15
  238.     objcache.c:          Section 16
  239.     proto.c:             Section 17
  240.     stat.c:              Section 18
  241.     stmem.c:             Section 19
  242.     store.c:             Section 20
  243.     tools.c:             Section 21
  244.     ttl.c:               Section 22
  245.     url.c:               Section 23
  246.     wais.c:              Section 24
  247.     mime.c:              Section 25
  248.     connect.c:           Section 26
  249.     send-announce.c:     Section 27
  250.     acl.c:               Section 28
  251.  
  252. Debugging levels are set in the configuration file with the 'debug_options'
  253. line.  For example:
  254.  
  255.     debug_options ALL,1 28,9 22,5
  256.  
  257.  
  258. New Access Control scheme
  259. ==============================================================================
  260. The old IP-based access controls have been replaced with a much more
  261. flexible scheme.  First you must define a set of access control lists. 
  262. There are N types of lists:
  263.  
  264.     'src'        client IP address
  265.     'dst'        server IP address**
  266.     'method'    method of the request (eg, GET, POST)
  267.     'proto'        protocol of the request (eg HTTP, WAIS)
  268.     'domain'    domain of the URL request (eg .foo.org)
  269.     'port'        port number of the URL request (eg 80, 21)
  270.     'time'        time-of-day and day-of-week
  271.             format: [SMTWHFA] [hh:mm-hh:mm]
  272.     'pattern'    regular expression matching on the URL-path
  273.  
  274. After the access lists have been defined, you can then combine them
  275. in way to allow or deny access.  
  276.  
  277. For example, your cache might be configured to accept requests 
  278. from both inside and outside of your organization.  In that case you'd
  279. probably want to allow internal clients to access anything, but limit
  280. outside access to only sites within your organization.  It could be
  281. done like this:
  282.  
  283.     acl ourclients src  128.138.0.0/255.255.0.0  198.117.213.0/24
  284.     acl ourservers domain .whatsamattu.edu
  285.  
  286.     http_access deny !ourclients !ourservers
  287.     http_access allow ourclients
  288.  
  289. If you wanted to limit FTP requests to off-peak hours, you could use:
  290.  
  291.     acl daytime time  MTWHF 08:00-17:00
  292.     acl FTP proto FTP
  293.     http_access deny FTP daytime
  294.  
  295. Any of the access list types can accept multiple values on the 
  296. same line, except for 'time'.  Multiple values of an 'acl'
  297. definition are treated with OR logic.  Multiple ACLs of
  298. an 'http_access' are treated with AND logic.  
  299. That is, all ACLs much match for the 'allow' or 'deny' take effect.
  300. The order of the 'http_access' lines are important.  When a line
  301. matches any following lines are not considered at all.
  302.  
  303. 'icp_access' is the same as 'http_access' but it applies to the ICP
  304. port.  However, it is not yet fully implemented.  It is only able to check
  305. 'src' and 'method' ACLs.
  306.  
  307. **Note, the 'dst' ACL type has been added for version 1.0.beta12.  In
  308. that version it is implemented in a "lazy" manner.  If the URL hostname
  309. is not already in the IP cache, the ACL checks will not match it, but
  310. they will start a DNS lookup so that it will likely be present for
  311. future ACL checks.  This means some users may occasionally get oddball
  312. results.  For example, a page may fail the first time, but succeed on
  313. the second try, or vice-versa.
  314.  
  315. Changes to cache shutdown
  316. ==============================================================================
  317. Squid attempts to implement a "nice shutdown" upon receipt of a SIGTERM
  318. signal.  Rather than simply breaking all current connections, it waits
  319. a configurable number of seconds for active requests to complete.  The
  320. default 'shutdown_lifetime' value is 30 seconds.
  321.  
  322. As soon as the SIGTERM is received, the incoming HTTP socket is closed
  323. so that no further requests will be accepted.  
  324.  
  325.  
  326. Using SIGHUP to reconfigure the cache
  327. ==============================================================================
  328. Sending the squid process a HUP signal will prompt it to re-read its
  329. configuration file.  Before it can be reconfigured, it must make sure
  330. that all active connections are closed.  For this purpose squid
  331. pretends to do a shutdown as described above; ie, it will wait up to
  332. 30 seconds for active requests to complete before re-reading the
  333. configuration file.
  334.  
  335.  
  336. ftpget server
  337. ==============================================================================
  338. The ftpget program has been modified to act as a server for FTP
  339. request.  You may now notice that an "ftpget -S" process is always
  340. present while the cache is running.  The benefit of using an ftpget
  341. server is that the cache process (which may be very large) no longer
  342. needs to fork itself for FTP requests.
  343.  
  344.  
  345. Assigning weights to cache neighbors
  346. ==============================================================================
  347. Squid allows you to assign weights to parent caches.  The weights are 
  348. used to calculate the ``first miss parent.''  The weight is specified in
  349. the 'options' field of the 'cache_host' line.  For example:
  350.  
  351.      cache_host  big.foo.org parent 3128 3130 weight=5
  352.  
  353. The weight must be a non-zero integer.  It is used as a divisor to
  354. calculate a weighted round-trip-time (RTT).  Higher weights will cause
  355. a parent to have a ``better'' RTT.
  356.  
  357. Weights are only involved when all parent caches return MISS.  Squid still
  358. fetches an object from the first parent or neighbor to reply with a HIT,
  359. regardless of any weight values.
  360.  
  361. Converting 'cache/log' from cached-1.4.pl3
  362. ==============================================================================
  363. Squid uses a slightly different format for the 'cache/log' file.  In 
  364. particular, the words 'FILE:' and 'URL:' have been removed from each
  365. line.  To save your on-disk cache, you will need to convert this log
  366. file before starting Squid.  To do that use a simple awk command:
  367.  
  368.      mv log log.old
  369.      awk '{print $2,$4,$5,$6,$7}' < log.old > log
  370.  
  371.  
  372. Notes on stoplists vs ttl_pattern
  373. ==============================================================================
  374. You can use the stoplists ('http_stop', etc) in the configuration file
  375. to prevent objects from being cached.  Using a 'ttl_pattern' with the
  376. TTL to zero will also prevent objects from being saved.
  377.  
  378. The 'http_stop' (etc) have a dual purpose: to prevent objects from
  379. being cached, and to prevent some requests from being queried at
  380. neighbor caches.  There is now a separate 'hierarchy_stoplist' which
  381. can be used to prevent the hierarchy queries, but still allow objects
  382. to be cached.  For example, if your parent cache does now allow FTP
  383. requests, then your hierarchy_stoplist should contain:
  384.  
  385.     hierarchy_stoplist ftp://
  386.  
  387.  
  388. SIGUSR1 now rotates log files
  389. ==============================================================================
  390. In order to be more consistent with other daemon programs, SIGHUP is
  391. used to reconfigure the running process.  This means that we needed to
  392. change the signal used to rotate the log files.  We now use SIGUSR1 to
  393. rotate the logs.
  394.  
  395.  
  396. ``no-query'' option for cache_host lines
  397. ==============================================================================
  398. Some cache configurations behind firewalls may require ICP to be used
  399. for caches behind the firewall, but not to caches on the other side
  400. (because the firewall blocks UDP traffic).  To achieve this, use the
  401. no-query option:
  402.  
  403.      cache_host   outside.my.org   parent   3128 3130  no-query
  404.      cache_host   inside.my.org    neighbor 3128 3130
  405.